package org.thread.Homework06;/*
 *@Author: gjh
 *Date: 2025/3/1219:06
 *Describe:
 */

import java.util.Random;

public class MyRunnable implements Runnable{
    private UserInformation userInformation;

    public MyRunnable(UserInformation userInformation) {
        this.userInformation = userInformation;
    }

    // private String LOCK = "";
    // private static Object LOCK = new Object();
    // private Class LOCK = Class.class;
    @Override
    public synchronized void run() {
            //synchronized (LOCK){
            //synchronized (this){
            StringBuffer sb = new StringBuffer();
            for(int i =1;i<5;i++){
                sb.append(userInformation.getContent());
            }
            System.out.println("使用者："+userInformation.getUsername()+"打印："+sb);
         }
    }

}
